package com.cysion.shell.resp.base

import com.cysion.otbox.net.ApiAction

class CodeMsgResult<T>:ApiAction {

    var code:String=""
    var message:String?=""
    var address:T?=null

    override fun outCode(): String {
        return code
    }

    override fun outMsg(): String {
        return message?:""
    }

    override fun outData(): Any? {
        return address
    }

    override fun isOk(): Boolean {
        return "200".equals(code)
    }
}
class StaResult<T>:ApiAction {

    var status:String=""
    var msg:String?=""
    var data:T?=null

    override fun outCode(): String {
        return status
    }

    override fun outMsg(): String {
        return msg?:""
    }

    override fun outData(): Any? {
        return data
    }

    override fun isOk(): Boolean {
        return "200".equals(status)
    }
}

open class ErrMsgResult:ApiAction {

    var errCode:String=""
    var errMsg:String?=""

    override fun outCode(): String {
        return errCode
    }

    override fun outMsg(): String {
        return errMsg?:""
    }

    override fun outData(): Any? {
        return this
    }

    override fun isOk(): Boolean {
        return "200".equals(errCode)
    }
}

data class Address(
    var city: String?,
    var country: String?,
    var street: String?
)